<style lang="less" scoped>
.panel {
  margin-bottom: 10px;
  background: white;
  &-title {
    font-size: 14px;
    padding: 10px;
    border-bottom: 1px solid #eaeaea;
  }
  &-content {
    overflow: hidden;
    margin-top: 10px;
  }
}
.step {
  display: flex;
  font-size: 14px;
  &-left {
    width: 80px;
    text-align: right;
    padding: 0 20px 0 10px;
  }
  &-right {
    flex: 1;
    padding: 0 10px 15px 20px;
    position: relative;
    .pab {
      position: absolute;
      display: block;
      content: ' ';
      background: #eaeaea;
    }
    &:before {
      .pab();
      left: 0;
      top: 7px;
      height: 100%;
      width: 1px;
    }
    &:after {
      .pab();
      top: 7px;
      left: -3.5px;
      width: 8px;
      height: 8px;
      border-radius: 100%;
    }
    &.active {
      &:after {
        left: -5px;
        background: #3399fe;
        border: 2px solid #a6d2ff;
      }
    }
  }

  &-item {
    display: flex;
  }
  &-label {
    color: #666;
  }
  &-value {
    word-wrap: break-word;
    word-break: break-all;
  }
  .time {
    color: #666;
  }
  .level {
  }
}
</style>

<template>
  <div>
    <load v-if="loading"></load>
    <div v-else-if="items.length==0" class="info">暂无数据</div>
    <div v-else>
      <div class="panel" v-for="(item, index) in items" :key="index">
        <div class="panel-title c-primary">{{item.ProductName||'-'}}</div>
        <div class="panel-content" v-if="item.FinancingList">
          <div class="step" v-for="(item1, index1) in item.FinancingList" :key="index1">
            <div class="step-left">
              <div class="time">{{item1.Date||'-'}}</div>
              <div class="level">{{item1.Round||'-'}}</div>
            </div>
            <div :class="['step-right',{active:index1==0}]">
              <div class="step-item">
                <div class="step-label">投资金额：</div>
                <div class="step-value">{{item1.Amount||'-'}}</div>
              </div>
              <template v-if="item1.Investments">
                <div class="step-item" v-for="(item2, index2) in item1.Investments" :key="index2">
                  <div class="step-label">投资方：</div>
                  <div class="step-value">{{item2.Name||'-'}}</div>
                </div>
              </template>
              <template v-if="item1.NewsTitle">
                <div class="step-item">
                  <div class="step-label">新闻源：</div>
                  <div class="step-value">{{item1.NewsTitle||'-'}}</div>
                </div>
              </template>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import Load from '@/components/load';
export default {
  components: { Load },
  computed: {
    loading() {
      return this.$store.getters.loading;
    }
  },
  data() {
    return {
      items: []
    };
  },
  onLoad() {
    this.getInfos();
  },
  methods: {
    async getInfos() {
      const url = '/app/searchFinancingsGroup';
      let unique = '';
      try {
        unique = this.$root.$mp.page.options.Unique;
      } catch (error) {}
      const params = { unique };
      const { status, message, result: { Result = [] } } = await this.$http.get(
        url,
        params
      );

      if (status != 200) {
        wx.showToast({
          title: message || '获取失败！',
          icon: 'none',
          mask: true
        });
        return;
      }
      this.items = Result;
    }
  }
};
</script>
